package com.test.auth_db_auto.utils;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.test.auth_db_auto.response.BaseResponse;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @ Author: .Mr
 * @ ClassName HttpUtils
 * @ Description TODO
 * @ date 2021/12/17 14:10
 * @ Version 1.0
 */
public class HttpUtils {

    public static void writer(BaseResponse bs, HttpServletResponse response) throws IOException {
        response.setContentType("application/json;charset=utf-8");
        response.setStatus(bs.getStatus());
        ObjectMapper objectMapper = new ObjectMapper();
        objectMapper.writeValue(response.getOutputStream(),bs);
    }
}
